import queue.Queue;
import queue.QueueController;
import queue.QueueGUI;
import utils.Logger;
import coreSimulation.PassengerList;
import coreSimulation.WindowController;
import dropoffdesk.DeskController;
import dropoffdesk.DeskGUI;
import dropoffdesk.DropOffDesk;

public class BaggageQueueSimulator {

	// path to the Queue's CSV input file
	private static final String QUEUE_INPUT_FILE = "PassengerList.csv";

	public static void main(String[] args) {

		// clear the log files
		Logger.getLogger().clearLog(Logger.ERROR);
		Logger.getLogger().clearLog(Logger.EVENT);

		// create a new queue passing the path to the input file
		Queue queue = new Queue(QUEUE_INPUT_FILE);
		// create the queue GUI
		QueueGUI queueGUI = new QueueGUI(queue);
		// Create the controller for the queue's GUI
		QueueController queueController = new QueueController(queue, queueGUI);
		
		//create the passenger list
		PassengerList passengerList = new PassengerList();

		// create the drop-off-desk to process the queue
		DropOffDesk desk = new DropOffDesk(queue, passengerList);
		// create the drop-off-desk's GUI
		DeskGUI deskGUI = new DeskGUI(desk);
		// create the controller to start the drop-off desk and manage events
		// from the desk's GUI
		DeskController deskController = new DeskController(deskGUI, desk);

		// create a controller to handle the window
		// close events for the two GUI components
		WindowController windowController = new WindowController(desk, queue);

		// add the controller to both GUIs' window listeners
		deskGUI.addWindowListener(windowController);
		queueGUI.addWindowListener(windowController);

	}
}
